package a_02_wizhi.Z_zookeeper;


class Father {
    private static int i = 1;
    static {
        System.out.println("Father.static initializer i" + i);
        System.out.println("子类静态代码块初始化");
        staticMethod();
        System.out.println(new Father());
        System.out.println(new Father().getNotStaticMethod());
    }

    private String s = "子类私有成员变量";
    {
        System.out.println("子类代码块初始化" + s);
        try {
            System.out.println("Son.instance initializer");
            this.finalize();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }
    private String k = "子类私有成员变量";


    public static void staticMethod() {
        System.out.println("静态方法初始化....");

    }
    public String getNotStaticMethod() {
        return "非静态方法";

    }
    public void show() {

        try {
            System.out.println("Son.show  初始化....gc");
            this.finalize();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        System.out.println("子类show()方法：i=" + i);
    }

    @Override
    public void finalize() throws Throwable {
        System.out.println("Son.finalize s===" + s);

        System.out.println("xigouhanshu");
    }

    public Father() {
        System.out.println("子类构造函数初始化完成");
        show();
    }
}

public class TestClassLoadSeq {
    public static void main(String[] args) {
        new Father();

    }

}